<?php

class get
{
    public static function test():bool{
        print_r($_SERVER);
        return true;
    }

    public static function getToolsList():string
    {
        $array = json_decode(file_get_contents("src/files/tools.json"),true);
        for ($i=0;$i<count($array);$i++){
            if ($a = @$array[$i]["link"]){
                $array[$i]["link"] = linkProcess("{LINK_$a}");
            }
        }
        $array = json_encode($array);
        print_r($array);
        return "ignore_script";
    }

    public static function index():bool
    {
        loadHtml("index");
        return true;
    }

    public static function bilibili_video():bool
    {
        loadHtml("bilibili_video");
        return true;
    }

    public static function douyin_video():bool
    {
        loadHtml("douyin_video");
        return true;
    }

    public static function qq_info():bool
    {
        loadHtml("qq_info");
        return true;
    }

    public static function qq_chat():bool
    {
        loadHtml("qq_chat");
        return true;
    }

    public static function qq_group():bool
    {
        loadHtml("qq_group");
        return true;
    }

    public static function qq_card():bool
    {
        loadHtml("qq_card");
        return true;
    }

    public static function qq_pc_online():bool
    {
        loadHtml("qq_pc_online");
        return true;
    }

    public static function site_title():bool
    {
        loadHtml("site_title");
        return true;
    }

    public static function site_logo():bool
    {
        loadHtml("site_logo");
        return true;
    }

    public static function netease_music():bool
    {
        loadHtml("netease_music");
        return true;
    }

    public static function netease_music_hot():bool
    {
        loadHtml("netease_music_hot");
        return true;
    }




    /*API文档页面*/
    public static function doc():bool
    {
        if (ENABLE_STATIC==1){
            if (strpos($_SERVER["REQUEST_URI"],"/?/")>=2){
                header("Location:/doc");
            }
        }
        loadHtml("doc/index",["STATIC"=>ENABLE_STATIC]);
        return true;
    }

    public static function docQQ_card():bool
    {
        loadHtml("doc/qq_card",["HOST"=>$_SERVER["HTTP_HOST"],"STATIC"=>ENABLE_STATIC,"PATH"=>"qq_card"]);
        return true;
    }

    public static function docQQ_info():bool
    {
        loadHtml("doc/qq_info",["HOST"=>$_SERVER["HTTP_HOST"],"STATIC"=>ENABLE_STATIC,"PATH"=>"qq_info"]);
        return true;
    }

    public static function docQQ_chat():bool
    {
        loadHtml("doc/qq_chat",["HOST"=>$_SERVER["HTTP_HOST"],"STATIC"=>ENABLE_STATIC,"PATH"=>"qq_chat"]);
        return true;
    }

    public static function docQQ_group():bool
    {
        loadHtml("doc/qq_group",["HOST"=>$_SERVER["HTTP_HOST"],"STATIC"=>ENABLE_STATIC,"PATH"=>"qq_group"]);
        return true;
    }

    public static function docQQ_pc_online():bool
    {
        loadHtml("doc/qq_pc_online",["HOST"=>$_SERVER["HTTP_HOST"],"STATIC"=>ENABLE_STATIC,"PATH"=>"qq_pc_online"]);
        return true;
    }






    /*API请求*/
    public static function apiQQ_card():bool
    {
        $qq = args_get("qq");
        $url = "https://api.vvhan.com/api/qqCard?qq=$qq";
        header("Location: $url");
        return true;
    }

    public static function apiQQ_info():bool
    {
        return post::apiQQ_info();
    }

    public static function apiQQ_chat():bool
    {
        $qq = args_get("qq");
        $url = "https://api.uomg.com/api/qq.talk?qq=$qq";
        header("Location: $url");
        return true;
    }

    public static function apiQQ_group():bool
    {
        $qid = args_get("qid");
        $url = "https://api.uomg.com/api/qq.joingroup?qid=$qid";
        header("Location: $url");
        return true;
    }

    public static function apiQQ_pc_online():bool
    {
        return post::apiQQ_pc_online();
    }
}